package com.shr.didi;

import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String arrayLine = sc.nextLine();	
		String[] strArray = arrayLine.split(" ");
		int[] array = new int[strArray.length];
		for(int i = 0;i<strArray.length;i++){
			array[i] = Integer.parseInt(strArray[i]) ;
		}
		int k = sc.nextInt();
		int start = 0;
		int end = array.length - 1;
		int index = partition(array, start, end);
		while(index != k-1){
			if(index > k-1){
				end = index - 1;
				index = partition(array, start, end);
			}else {
				start = index + 1;
				index = partition(array, start, end) ;
			}
		}
		System.out.println(array[k-1]);
		sc.close();
		
	}

	private static int partition(int[] array, int start, int end) {
		int key = array[start];
		while(start < end){
			while(start < end && array[end] <= key) end--;
			array[start] = array[end] ;
			while(start < end && array[start] >= key) start++;
			array[end] = array[start] ;
		}
		array[start] = key;
		return start;
	}
}
